﻿using System;
using System.Threading;
using System.Threading.Tasks;

namespace TaskTest
{
    class Program
    {
        static void Main(string[] args)
        {
            ThreadPool.SetMaxThreads(1000, 1000);
            Task.Factory.StartNew(() => ThreadPoolMessage());
            Console.ReadKey();
        }

        static void ThreadPoolMessage()
        {
            int a, b;
            ThreadPool.GetAvailableThreads(out a, out b);
            string message = string.Format("CurrentThreadIs is:{0}\n" +
                "CurrentThread IsBackground:{1}\n" +
                "WorkerThreads is:{2}\nCompletionPortThreads is:{3}\n",
                Thread.CurrentThread.ManagedThreadId,
                Thread.CurrentThread.IsBackground.ToString(),
                a.ToString(), b.ToString());
            Console.WriteLine(message);
        }
    }
}
